package org.kealinghornets.jchuah.myapplication;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.Toast;



public class MyActivity2 extends Activity {

    int numCleared = 0;

    public void onBoom(View view) {

        Toast.makeText(this, "BOOOOOOOOOOOOOM You Lose!!!!!!!!!!!!!!!", Toast.LENGTH_LONG).show();

        startActivity(new Intent(this, MyActivity.class));
    }
    public  void onNoboom (View view){
        view.setVisibility(View.GONE);
    }

    public void onPay (View view) {
        if (view.getVisibility() == View.GONE) {
            Log.d("animation", "fade out");
            numCleared = numCleared + 1;

            if (numCleared == 16)
                Toast.makeText(this, "You win. Press button to play again.",Toast.LENGTH_LONG ).show();
            startActivity(new Intent(this, MyActivity3.class));
        }
    }


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_my_activity2);
    }


    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.my_activity2, menu);
        return true;
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        // Handle action bar item clicks here. The action bar will
        // automatically handle clicks on the Home/Up button, so long
        // as you specify a parent activity in AndroidManifest.xml.
        int id = item.getItemId();
        if (id == R.id.action_settings) {
            return true;
        }
        return super.onOptionsItemSelected(item);
    }
}
